package com.scs.application.modules.volant.util;
import org.springframework.util.ResourceUtils;

public class Env {
    /**
     * 根据包名返回包的磁盘路径
     *
     * @param packageName 包名称，示例：com.scs.application.abc
     * @return 类的磁盘路径，示例：
     */
    public static String getPackagePath(String packageName) throws Exception {
        String packagePath = ResourceUtils.getURL("classpath:").getPath().substring(1) + packageName.replaceAll("\\.", "/");
        if (!packagePath.endsWith("/")) {
            packagePath += "/";
        }
        return packagePath;
    }
}
